<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="/WEB-INF/jsp/commons/taglibs.jsp" %>
<!DOCTYPE HTML>
<html ng-app>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <META HTTP-EQUIV="pragma" CONTENT="no-cache">
    <META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
    <META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
    <title>${title}</title>
    <%@ include file="/WEB-INF/jsp/commons/meta.jsp" %>
    <link href="${ctx}/resources/new/style.css" type="text/css" rel="stylesheet"/>

</head>
<body>
<script>
    $(document).ready(function () {
        //聚焦第一个输入框
        $("input").get(0).focus();
    });
</script>
<form id="inputForm" class="well form-inline" action="${ctx}/adoms/brand/saveAgent" method="post">
    <table class="table table-striped table-bordered table-condensed">
        <thead>
        <i class="icon-flag"></i>
        <strong>品牌代理商设定</strong>
        </thead>
        <tr>
            <td class="span2">品牌名称:</td>
            <td>
                <c:if test="${brand != null }">
                    <input value="${brand.id }" type="hidden" name="id"/>${brand.name }
                </c:if>
                <c:if test="${brandList != null }">
                    <select id="id" name="id">
                        <c:forEach items="${brandList }" var="brand">
                            <option value="${brand.id }">${brand.name }</option>
                        </c:forEach>
                    </select>
                </c:if>
            </td>
        </tr>
        <tr>
            <td>代理商(门店):</td>
            <td>
                <c:forEach items="${departmentList }" var="department">
                    <label class="checkbox">
                        <input name="department.id" value="${department.id }" type="checkbox"
                                <c:forEach items="${brand.department }" var="d">
                                    <c:if test="${d.id == department.id }">checked</c:if>
                                </c:forEach> />
                            ${department.name }
                    </label>
                </c:forEach>
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <input class="btn" type="submit" value="提交"/>
                &nbsp;
                <input class="btn" type="button" value="返回" back="back" onclick="history.go(-1)"/>
            </td>
        </tr>
    </table>
</form>
</body>
</html>